import * as React from 'react'
// import * as ReactSwipe from 'react-swipe'
import SwiperItems from './SwiperItems'
import SwiperDots from './SwiperDots'
import './index.less'

interface Props {
  sliders:string[]
}
 
interface State {
  selectedIndex:number
}
 
class HomeSwiper extends React.Component
<Props,State> 
{
  state = { selectedIndex: 0 }
  changeSelectedIndex=(selectedIndex:number)=>{
    (this.refs.swiperDots as any).changeSelectedIndex(selectedIndex)
  }
  render() { 
    let {sliders} = this.props
    console.log(sliders)
    return ( 
      <div className="home-swiper">
        <SwiperItems sliders={sliders} changeSelectedIndex={this.changeSelectedIndex}></SwiperItems>
        <SwiperDots ref="swiperDots" sliders={sliders}
       
        ></SwiperDots>
      </div>
    )
  }
}
 
export default HomeSwiper